From: Zeeshan Ali (Khattak) Date: Thu, 11 Sep 2014 13:57:15 +0000 (+0100) Subject: location: Translate accuracy level for geoclue X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~1013^2^2~2158 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=7653175c6ff0b3842cbee4accc4fe9e94a28e7a5;p=gnome-shell.git location: Translate accuracy level for geoclue The enums values of geoclue have gaps in them (so more levels could be added in future) but enum values of settings don't have such gaps so we gotta translate between them. Since desrt says that enums as integers in gsettings are bad, we now treat accuracy level settings as string. This fixes the recent regression of geoclue only allowing geiop level accuracy to apps. https://bugzilla.gnome.org/show_bug.cgi?id=736479 --- diff --git a/js/ui/status/location.js b/js/ui/status/location.js index c6694d1a0..9dc736eb7 100644 --- a/js/ui/status/location.js +++ b/js/ui/status/location.js @@ -13,6 +13,15 @@ const LOCATION_SCHEMA = 'org.gnome.system.location'; const MAX_ACCURACY_LEVEL = 'max-accuracy-level'; const ENABLED = 'enabled'; +const GeoclueAccuracyLevel = { + NONE: 0, + COUNTRY: 1, + CITY: 4, + NEIGHBORHOOD: 5, + STREET: 6, + EXACT: 8 +}; + var GeoclueIface = ' \ \ \ @@ -181,10 +190,14 @@ const Indicator = new Lang.Class({ }, _getMaxAccuracyLevel: function() { - if (this._settings.get_boolean(ENABLED)) - return this._settings.get_enum(MAX_ACCURACY_LEVEL); - else - return 0; + if (this._settings.get_boolean(ENABLED)) { + let level = this._settings.get_string(MAX_ACCURACY_LEVEL); + + return GeoclueAccuracyLevel[level.toUpperCase()] || + GeoclueAccuracyLevel.NONE; + } else { + return GeoclueAccuracyLevel.NONE; + } }, _notifyMaxAccuracyLevel: function() {